//
//  MWCaptureManager.h
//  AV0CSC
//
//  Created by jinbang.li on 2024/3/16.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

@protocol MWCaptureManagerDelegate <NSObject>

@optional
- (void)captureAudioSampleBuffer:(CMSampleBufferRef _Nullable )sampleBufferRef;

- (void)captureVideoSampleBuffer:(CMSampleBufferRef _Nullable )sampleBufferRef;
@end

NS_ASSUME_NONNULL_BEGIN

@interface MWCaptureManager : NSObject

- (instancetype)init;

+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;

@property(nonatomic,weak)id<MWCaptureManagerDelegate> delegate;

/**
 配置捕捉会话的分辨率
 */
- (void)configSessionPreset:(AVCaptureSessionPreset)sessionPreset;
/**
 配置帧率 fps
 */
- (void)configVideoFps:(NSUInteger)fps;

/**
  配置视频的输入
 传入NSError的二级指针：传入NSError * error,参数为&error，
 返回值为NO，即可取出error对应的错误信息
 */
- (BOOL)configVideoInput:(NSError **)error;
/**
 移除视频输入设备
 */
- (void)removeVideoDeviceInput;

/**
 配置静态图片输出
 */
- (void)configStillImageOutput;
/**
 移除静态图片输出
 */
- (void)removeStillImageOutput;
/**
 同步开启捕捉会话
 */
- (void)startSessionSync;
/**
 同步关闭捕捉会话
 */
- (void)stopSessionSync;
/**
 异步开启捕捉会话
 */
- (void)startSessionAsync;

/**
 异步关闭捕捉会话
 */
- (void)stopSessionAsync;
@end

NS_ASSUME_NONNULL_END

